package org.ch02.job.test03;

import java.lang.reflect.Constructor;
import java.lang.reflect.Method;

/**
 * @author XCH
 * @date 2025 - 03 - 17
 */
public class MainTest {
    public static void main(String[] args) {
        try {
            Class<?> clazz = Class.forName("org.ch02.test03.Student");
            Constructor<?> constructor = clazz.getDeclaredConstructor(String.class, int.class, Double.class);
            Object obj = constructor.newInstance("张三", 20, 80.5);
            System.out.println(obj);
            Method method = clazz.getMethod("show");
            method.invoke(obj);
        } catch (Exception e) {
            throw new RuntimeException(e);
        }
    }
}
